<html>
<head>
    <title>使用内置函数</title>
</head>
<body>

<p>常用内建函数的示例：</p>
<#assign htmlCode="hello <label style=\"color:red;\">world</label>" />
<#assign user="administrator" />
<p>html=${htmlCode?html}</p>
<p>upper_case=${user?upper_case}</p>
<p>cap_first=${user?cap_first}</p>
<p>length=${user?length}</p>

<p>list 标签中内置函数示例：</p>
<#assign books=["Java", "C#", "C++"] />
<p>size=${books?size}</p>
<#list books>
    <#items as book>
        <p>index=${book?index}</p>
        <p>counter=${book?counter}</p>
        <p>item_parity=${book?item_parity}</p>
    </#items>
</#list>

<p>一些内建函数需要参数来指定行为</p>
<#assign colors=["red", "blue", "green"] />
<#assign flag=false />
<p>string=${flag?string("Y", "N")}</p>
<#list books>
    <#items as book>
        <p>item_parity=${book?item_cycle("lightRow", "darkRow")}</p>
    </#items>
</#list>

<p>join=${colors?join(",")}</p>
<#if user?starts_with("a")>
    <p>starts_with=${user} 以a开头</p>
<#else>
    <p>starts_with=${user} 不以a开头</p>
</#if>

</body>
</html>